import fs from 'fs';
import path from 'path';
import * as vscode from 'vscode';
// const config = require('./config');

export const setConfig = (context: vscode.ExtensionContext,data:{enabled:string,port:number}) => {
    context.globalState.update('enabled', data.enabled)
    context.globalState.update('port', data.port)
    console.log('设置数据',data)
}

export const  getConfig =  (context: vscode.ExtensionContext) => {
    // try {
     
        let enabled = context.globalState.get('enabled');
        let port = context.globalState.get('port');
        if (!enabled && !port) {
            context.globalState.update('enabled', 'enabled')
            context.globalState.update('port', '7456')
        }
        console.log('获取数据',enabled,port)
        return {
            enabled,
            port
        }
    // } catch (error) {
    //     console.log(error)
    // }
    
}